package bhbt.controller.admin.member;


import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import bhbt.controller.core.BaseController;
import bhbt.model.Daili;
import bhbt.service.DailiService;
import bhbt.utils.MapUtil;






/**
 * Created by Administrator on 2016/3/25.
 */
@Controller
 
public class DailiShowController extends BaseController {
	@Resource
    private DailiService dailiService;
   
   

    @RequestMapping("admin/member/dailiShow.shtml")
    public String show(HttpServletRequest request) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
        if(0 < id){
        	Daili daili = dailiService.getByKey(id);
           
            request.setAttribute("daili",daili);
        }
        return "admin/member/dailiShow";
       
    }
    
    
    @RequestMapping("admin/member/dailiUpdate.shtml")
    public String update(Daili daili ,HttpServletRequest request, ModelMap model) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
       
        if(0 < id){
        	 
        	dailiService.update(daili);
            setMessage(model,"更新成功！");
            request.setAttribute("daili",daili);
            
        }
        return "admin/member/dailiShow";
    }

     
    

}
